﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;

namespace Rdz.Utility
{
	public class WebUtility
	{
		/// <summary>
		/// Read Application Settings from Web Configuration File (web.config).
		/// </summary>
		/// <param name="KeyName">Key Name to read to.</param>
		public static string ReadConfig(string KeyName)
		{
			return ReadConfig(KeyName, "");
		}
		/// <summary>
		/// Read Application Settings from Web Configuration File (web.config).
		/// </summary>
		/// <param name="KeyName">Key Name to read to.</param>
		/// <param name="DefaultValue">Default value if there's no App Settings with the provided Key Name.</param>
		public static string ReadConfig(string KeyName, string DefaultValue)
		{
			try
			{
				return WebConfigurationManager.AppSettings[KeyName];
			} catch
			{
				return DefaultValue;
			}
		}
	}
}
